package com.cmc.cloud.cmclink.doc.api.document;

import com.cmc.cloud.cmclink.doc.api.document.req.si.BlnoSignTypeUpdateDto;
import com.cmc.cloud.cmclink.doc.constant.DocApiConstants;
import com.cmes.framework.common.pojo.CommonResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import javax.validation.Valid;
import java.util.List;

/**
 * SI信息更新
 *
 * 给edi 或网厅使用
 * 根据提单号 更新signtype of blno
 * datasource = edi or web
 * creator = 用户id
 *
 * @author stq
 */
@FeignClient(name = DocApiConstants.NAME)
@Tag(name = "RPC - 服务 SI基础信息更新")
@Valid
public interface BlnoInfoUpdateApi {

    String PREFIX = DocApiConstants.PREFIX + "/SI";

    /**
     * 自主签发
     *
     * @param updateDto
     * @return
     */
    @PostMapping(PREFIX + "/update/signType")
    @Operation(summary = "更新SI信息signType")
    CommonResult<Void> updateSignType(@Valid @RequestBody BlnoSignTypeUpdateDto updateDto);

    /**
     * 取消签发
     *
     * @param blnoId
     * @return
     */
    @GetMapping(PREFIX + "/cancelSignType/{blnoId}")
    @Operation(summary = "取消签发")
    CommonResult<Void> cancelSignType(@PathVariable("blnoId") Long blnoId);

    /**
     * 自主签发
     *
     * @param updateDtoList
     * @return
     */
    @PostMapping(PREFIX + "/batchUpdateSignType")
    @Operation(summary = "批量更新SI信息signType")
    CommonResult<Void> batchUpdateSignType(@Valid @RequestBody List<BlnoSignTypeUpdateDto> updateDtoList);
}
